// components/searchBox/index.ts

Component({
  /**
   * 组件的属性列表
   */
  properties: {},

  /**
   * 组件的初始数据
   */
  data: {
    searchText: "",
  },

  /**
   * 组件的方法列表
   */
  methods: {
    async search(ev: { detail: string }) {
      (this as any).setData({
        searchText: "",
      });
      wx.navigateTo({
        url: "/pages/search/search?query=" + ev.detail,
      });

      // console.log(ev.detail);

      // console.log(ev.detail);
      // const params: object = { query: ev.detail, pagenum: 1, pagesize: 10 };
      // const res = await wx.http.get("/goods/search", params);
      // const params:object={qsearch:ev.detail}
      // const res=await wx.http.get('/goods/qsearch',params)
      // console.log(res);
    },
  },
});
